package com.example.controller;

import com.example.domain.Orders;
import com.example.service.IOrderDetailService;
import com.example.service.IOrdersService;
import com.example.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/order")
public class OrdersController {
    @Autowired
    private IOrdersService ordersService;
    //添加订单信息
    @RequestMapping("/submit")
    private R submit(@RequestBody Orders orders, HttpSession session){
        Long user = (Long) session.getAttribute("user");
        ordersService.submit(orders,user);
        return new R(1);
    }
}
